import 'package:flutter_test/flutter_test.dart';
import 'package:logger_plugin/logger_plugin.dart';
import 'package:logger_plugin/logger_plugin_platform_interface.dart';
import 'package:logger_plugin/logger_plugin_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockLoggerPluginPlatform
    with MockPlatformInterfaceMixin
    implements LoggerPluginPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<void> logE(String tag, String msg) {
    // TODO: implement logE
    throw UnimplementedError();
  }

  @override
  void logI(String tag, String msg) {
    // TODO: implement logI
  }
}

void main() {
  final LoggerPluginPlatform initialPlatform = LoggerPluginPlatform.instance;

  test('$MethodChannelLoggerPlugin is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelLoggerPlugin>());
  });

  test('getPlatformVersion', () async {
    LoggerPlugin loggerPlugin = LoggerPlugin();
    MockLoggerPluginPlatform fakePlatform = MockLoggerPluginPlatform();
    LoggerPluginPlatform.instance = fakePlatform;

    expect(await loggerPlugin.getPlatformVersion(), '42');
  });
}
